#include "gui/gui_infobar.h"
#include "gui/gui.h"
#include "city.h"
#include <sstream>

//////////////////////////////////////////////////
//  GuiInfoBar::GuiInfoBar()
//////////////////////////////////////////////////
GuiInfoBar::GuiInfoBar(City* city) :
    city(NULL)
{
    this->city = city;

    myWindow = sfg::Window::Create(sfg::Window::Style::BACKGROUND);

    sfg::Box::Ptr container = sfg::Box::Create(sfg::Box::Orientation::VERTICAL, 0.f);
    myWindow->Add(container);

    // CityName label
    cityName = sfg::Label::Create("City Name");
    container->Pack(cityName);

    // Money label
    money = sfg::Label::Create("$");
    container->Pack(money);
}

//////////////////////////////////////////////////
//  void GuiInfoBar::update(double dt)
//////////////////////////////////////////////////
void GuiInfoBar::update(double dt)
{
    std::stringstream ss;
    ss << "$" << city->getMoney() << "\n";
    money->SetText(ss.str());
}
